package ee.falcon.gui.frame.actionlisteners;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import ee.falcon.gui.frame.NewOrEditProfileFrame;
import ee.falcon.gui.frame.ProfilesFrame;
import ee.falcon.xml.ProfileInfoList;
import ee.falcon.xml.SpecificProfileInfo;

public class NewOrEditButtonListener implements ActionListener
{
	private boolean isEditProfileFrame; //if not, then it is NewProfileFrame; 
	private NewOrEditProfileFrame newOrEditProfileFrame; 
	private ProfilesFrame profile; 
	private SpecificProfileInfo jListSelection; 
	private ProfileInfoList profileInfoList;  
	
	/*public NewAndEditButtonListener(Profile profile, ProfileInfoXMLModifier profileInfoXMLModifier,
			SpecificProfileInfo jListSelection, Map<String, SpecificProfileInfo> profileInfoHashMap)*/
	public NewOrEditButtonListener(boolean isEditProfileFrame, ProfileInfoList profileInfoList,
			ProfilesFrame profile)
	{
		System.out.println("you2" + jListSelection);
		this.profile = profile;  
		this.profileInfoList = profileInfoList; 
		this.isEditProfileFrame = isEditProfileFrame; 
		System.out.println("you2" + jListSelection);
	}

	@Override
	public void actionPerformed(ActionEvent e) 
	{
		newOrEditProfileFrame = new NewOrEditProfileFrame(isEditProfileFrame, 
				profileInfoList, profile.getSpecificProfileInfoJListSelection(), profile); 
		newOrEditProfileFrame.setVisible(true); 
	}

}
